const Sequelize = require('sequelize');
const config = require('config').get('db')

const sequelize = new Sequelize(config.dbuser, config.user, config.password, {
    host: config.host,
    dialect: 'mysql',
    port: config.port,
    timezone: '+08:00' //东八时区
}
)

sequelize
    .authenticate()
    .then(() => {
        console.log('连接成功！');
    })
    .catch(err => {
        console.error('连接失败！');
    });
module.exports = { Sequelize, sequelize }